package cn.com.homeyoda.aimate.aihealth.utils;

import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import cn.com.homeyoda.aimate.aihealth.R;


/**
 * Created By 刘纯贵
 * Created Time 2020/6/3
 */
public class ShowXiaZaiDialog {
    private  Context mContext;
    private  Dialog dialog;
    private  View inflate;
    private ImageView close;
    private ImageView qrCode;


    public ShowXiaZaiDialog(Context context, String url){
        //mContext = context;
        if(dialog == null){
            dialog = new Dialog(context, R.style.FullScreenDialog);
            inflate = LayoutInflater.from(context).inflate(R.layout.dialog_qrcode_xiazai, null);
            dialog.setContentView(inflate);
            dialog.setCanceledOnTouchOutside(false);
            close = inflate.findViewById(R.id.iv_close);
            qrCode = inflate.findViewById(R.id.qrcode);
            Glide.with(context)
                    .load(url)
                    .into(qrCode);

            close.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    dismiss();
                }
            });

        }




    }



    public void Show(){
        dialog.show();
    }

    public  void dismiss(){
        if (dialog != null && dialog.isShowing()) {
            Log.i("huahua","dialog.==dismiss==");
            dialog.dismiss();
            dialog = null;
        }
    }
}
